package com.It;

import java.util.Scanner;

//评委打分
public class test3 {
    public static void main(String[] args) {
        int[] arr = new int[6];

        Scanner sc = new Scanner(System.in);
        for(int i = 0;i<arr.length;i++){
            System.out.println("输入第"+(i+1)+"个评委的打分:");
            arr[i] = sc.nextInt();
            if(arr[i]<0||arr[i]>100){
                System.out.println("输入的打分有误!");
                break;
            }
        }
        int max = getMax(arr);
        int min = getMin(arr);
        int sum = sum(arr);
        System.out.println("平均分为:"+(double)(sum-max-min)/ (arr.length-2));
    }
    public static int getMax(int[] arr){
        int max = arr[0];
        for(int i = 1;i<arr.length;i++){
            if(arr[i] > max)
                max = arr[i];
        }
        return max;
    }
    public static int getMin(int[] arr){
        int min = arr[0];
        for(int i = 1;i<arr.length;i++){
            if(min > arr[i])
                 min = arr[i];
        }
        return min;
    }
    public static int sum(int[] arr){
        int sum = 0;
        for(int i = 0;i<arr.length;i++){
            sum += arr[i];
        }
        return sum;
    }

}
